package com.walle.sonar.export.report.generate.generateWordForIssues;

import com.walle.ak47.commons.utils.FileUtils;
import com.walle.ak47.commons.utils.StringUtils;
import com.walle.sonar.export.report.generate.JacobUtil;

public class FileConverter {

	/**
	  *  输出htmlTemplate文件路径
	 * @param wordFile
	 * @return
	 */
	public static String word2Html(String wordFile) {
		
		String htmlfile = StringUtils.replace(wordFile, ".doc", ".html") ;
		FileUtils.deleteFile(htmlfile) ;
		JacobUtil.wordToHtml(wordFile, htmlfile);
		return htmlfile;
	}
	
	/**
	  *  输出htmlTemplate文件路径
	 * @param htmlFile
	 * @return
	 */
	public static String target(String htmlFile) {

		String wordFile = StringUtils.replace(htmlFile, ".html", "_正式.doc") ;
		FileUtils.deleteFile(wordFile) ;
		JacobUtil.wordToHtml(htmlFile, wordFile);
		return wordFile;
	}
}
